#include <iostream>

template <class T>
class TreeNode{
    T data;
    TreeNode<T>* LT,RT,Bro;
    TreeNode(T key){
        data = key;
        LT=RT=Bro=NULL;
    }
};

template <class T>
int count(TreeNode<T>* root){
    if(root==NULL) return 0;
    return 1 + count(root->LT) + count(root->RT);
}

template <class T>
int measure(TreeNode<T>* root){
    if (root==NULL) return 0;
    int count;
    if ((root->LT==NULL)&&(root->RT==NULL)) count=2;
    else count=1;
    int l = measure(root->LT);
    int r = measure(root->RT);
    return std::max(l,r,count);
}

template <class T>
int height(TreeNode<T>* root){
    if (root==NULL) return 0;
    int l = height(root->LT);
    int r = height(root->RT);
    return std::max(l,r)+1;
}